/**
 * 
 */
package de.tum.in.eist.poll.client.controllers;

import com.google.gwt.user.client.rpc.AsyncCallback;

import de.tum.in.eist.poll.client.DelayedAction;
import de.tum.in.eist.poll.shared.beans.Lecture;
import de.tum.in.eist.poll.shared.beans.QuestionGroup;

/**
 * @author Sebastian Hofstetter
 *
 */
public class LectureManagementController extends Controller {
	public void addLectures(String title, QuestionGroup questions) {
		String lectureId = (new Object()).toString();
		pollService.addLecture(new Lecture(lectureId, Controller.controller.getLecturer(), title, questions), new AsyncCallback<String>() {
			
			@Override
			public void onSuccess(String result) {
				
				Controller.controller.refreshLectures(new DelayedAction() {
					
					@Override
					public void run() {
						Controller.controller.refreshPage();
					}
				});
				
			}
			
			@Override
			public void onFailure(Throwable caught) {}
		});
	}

}
